<?php

class Template{

    private  $name;
    private  $type;
    private $content;

    public function __construct($name,$type=0){
        $this->name = $name;
        try{
            $this->content = file_get_contents("templates/" . $name);
        }catch(Exception $e){
            die($name . " konnte nicht als Template geladen werden! " . $e);
        }
    }

    public function out(){
        echo $this->content;
    }

    public function loadTemplate($name){
        $tmp = new Template($name,1);
        
        return $tmp->content;
    }

    public function set($key,$val){
        $this->content = str_replace('{$' . $key . '}',$val,$this->content);
    }

}

?>